import request from '@/utils/request'
// import storage from 'store'

const mainApi = {
  outApi: '/api/v1/outApi',
  openDir: '/api/v1/example/openLocalDir',
  uploadFile: '/api/v1/example/uploadFile',
  autoLaunchEnable: '/api/v1/setting/autoLaunchEnable',
  autoLaunchDisable: '/api/v1/setting/autoLaunchDisable',
  autoLaunchIsEnabled: '/api/v1/setting/autoLaunchIsEnabled',
  showScanCode: 'https://www.pgyer.com/apiv2/app/view',
  listMy: 'https://www.pgyer.com/apiv2/app/listMy'
}

/**
 * outApi
 */
export function outApi (uri, parameter) {
  return request({
    url: mainApi[uri],
    method: 'post',
    data: parameter
  })
}

/**
 * local api
 */
export function localApi (uri, parameter) {
  return request({
    url: mainApi[uri],
    method: 'post',
    data: parameter
  })
}

/**
 * openDir
 */
export function openDir (parameter) {
  return request({
    url: mainApi.openDir,
    method: 'post',
    data: parameter
  })
}

/**
 * uploadFile
 */
export function uploadFile (parameter) {
  return request({
    url: mainApi.uploadFile,
    method: 'post',
    data: parameter
  })
}

/**
 * uploadFile
 */
export function showScanCode (parameter) {
  return request({
    url: mainApi.showScanCode,
    method: 'post',
    data: parameter,
	headers:{
		'content-Type': 'application/x-www-form-urlencoded',
    }
  })
}

/**
 * 查看自己上传的应用
 */
export function listMy (parameter) {
  return request({
    url: mainApi.listMy,
    method: 'post',
    data: parameter,
	headers:{
		'content-Type': 'application/x-www-form-urlencoded',
    }
  })
}